package com.hwl.demo12.service.impl;

import com.hwl.demo12.entity.Work;
import com.hwl.demo12.service.State;

/**
 * 晚间工作状态
 *
 * @author sentry
 * @since 2023-03-20
 */
public class EveningState extends State {
    @Override
    public void writeProgram(Work w) {
        if (w.isWorkFinished()) {
            w.setState(new RestState());
            w.writeProgram();
        } else {
            if (w.getHour() < 21) {
                System.out.println("当前时间：" + w.getHour() + "点 加班哦，疲惫至极");
            } else {
                w.setState(new SleepingState());
                w.writeProgram();
            }
        }
    }
}
